package com.eos.control.action.activity;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysActivty;
import com.eos.orm.mybatis.model.SysUser;

public class DeleteActivityAction extends AbstractBaseAction {
	private static final long serialVersionUID = 3687788636116543395L;
	private Integer activtyId;

	public void setActivtyId(Integer activtyId) {
		this.activtyId = activtyId;
	}

	@Override
	public String execute()  {
		try {
			if(activtyId == null || activtyId.longValue() <=0){
				statusCode = "300";
				message = "参数错误, 删除活动失败!";
			}else{
				SysUser user = (SysUser)getSession().getAttribute("SysUser");
				String userId = user.getId() +"";
				SysActivityBusinessService sabs = new SysActivityBusinessService();
				SysActivty activty = new SysActivty();
				activty.setId(activtyId);
				activty.setDealFlag(ConstantTool.DEAL_FLAG_FAIL);
				activty.setModifyTime(ObjectUtils.formatDate(null, "yyyy-MM-dd HH:mm:ss"));
				activty.setUpdateUserId(userId);
				String exeStatus = sabs.updateSysActivtyPKSelective(activty);
				if("SUCCESS".equals(exeStatus)){
					statusCode = "200";
					message = "删除活动信息成功!";
				}else{
					statusCode = "300";
					message = "系统繁忙, 删除信息失败!";
				}
			}
		} catch (Exception e) {
		    e.printStackTrace();
		    statusCode = "300";
		    message = "系统异常, 删除活动信息失败!";
		}
		return SUCCESS;
	}
}
